<template>
	<el-input-number v-model="val" @change="change" controls-position="right" size="small"></el-input-number>
</template>

<script>
	export default {
		name: 'text-number',
		props: {
			value: Number,
			type: {
				type: String
			},
			placeholder: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				val: parseInt(this.value),
			}
		},
		watch: {
			value(val) {
				this.val = parseInt(val)
			}
		},
		methods: {
			change(data) {
				this.$emit("change", {
					key:this.type,
					value: data
				});
				this.$emit("input", parseInt(this.val));
			},
		}
	}
</script>
